<?php
if(isset($_SESSION["LANG"]) && $_SESSION["LANG"] != "") {
	$language = $_SESSION["LANG"];
} else {
	$lang = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
	for($i = 0; $i < sizeof($lang); $i++) {
		if(substr($lang[$i], 0, 2) == "en") {
			$language = "en_EN";
			break;
		} else if(substr($lang[$i], 0, 2) == "fr") {
			$language = "fr_FR.UTF8";
			break;
		}
	}
}
	$domain = 'messages';
	setlocale(LC_ALL, $language);
	bindtextdomain($domain, "lang/locale");
	textdomain($domain);
?>
